package com.hnit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnit.web.bean.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * 商品数据访问层接口
 * 继承MyBatis-Plus的BaseMapper，提供基础的CRUD操作
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    @Select("<script>" +
            "SELECT * FROM product WHERE productId IN " +
            "<foreach item='id' collection='ids' open='(' separator=',' close=')'>" +
            "#{id}" +
            "</foreach>" +
            "</script>")
    List<Product> selectByIds(@Param("ids") Collection<Long> ids);
}